package com.wn.class30.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * comment
 * @author 
 */
public class Comment implements Serializable {
    /**
     * 主键
     */
    private Integer commentId;

    /**
     * 评论详情
     */
    private String commentDesc;

    /**
     * 用户id
     */
    private Integer userId;

    /**
     * 商品id
     */
    private Integer productId;

    /**
     * 评论时间
     */
    @JsonFormat(shape=JsonFormat.Shape.STRING,pattern="yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date commentTime;

    /**
     * 评论星数（1-5）
     */
    private Integer commentPoint;

    /**
     * 商家回复评论
     */
    private String commentAnswer;

    /**
     * 是否回复（1：已回复；2：未回复）
     */
    private Integer isanswer;

    /**
     * 商家ID
     */
    private Integer businessId;

    /**
     * 订单项ID
     */
    private Integer myorderDetailId;

    private Product product;

    private List<CommentImg> commentImg;

    private User user;

    private static final long serialVersionUID = 1L;

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public Product getProduct() {
        return product;
    }

    public void setProduct(Product product) {
        this.product = product;
    }

    public List<CommentImg> getCommentImg() {
        return commentImg;
    }

    public void setCommentImg(List<CommentImg> commentImg) {
        this.commentImg = commentImg;
    }

    public Integer getCommentId() {
        return commentId;
    }

    public void setCommentId(Integer commentId) {
        this.commentId = commentId;
    }

    public String getCommentDesc() {
        return commentDesc;
    }

    public void setCommentDesc(String commentDesc) {
        this.commentDesc = commentDesc;
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public Integer getProductId() {
        return productId;
    }

    public void setProductId(Integer productId) {
        this.productId = productId;
    }

    public Date getCommentTime() {
        return commentTime;
    }

    public void setCommentTime(Date commentTime) {
        this.commentTime = commentTime;
    }

    public Integer getCommentPoint() {
        return commentPoint;
    }

    public void setCommentPoint(Integer commentPoint) {
        this.commentPoint = commentPoint;
    }

    public String getCommentAnswer() {
        return commentAnswer;
    }

    public void setCommentAnswer(String commentAnswer) {
        this.commentAnswer = commentAnswer;
    }

    public Integer getIsanswer() {
        return isanswer;
    }

    public void setIsanswer(Integer isanswer) {
        this.isanswer = isanswer;
    }

    public Integer getBusinessId() {
        return businessId;
    }

    public void setBusinessId(Integer businessId) {
        this.businessId = businessId;
    }

    public Integer getMyorderDetailId() {
        return myorderDetailId;
    }

    public void setMyorderDetailId(Integer myorderDetailId) {
        this.myorderDetailId = myorderDetailId;
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Comment other = (Comment) that;
        return (this.getCommentId() == null ? other.getCommentId() == null : this.getCommentId().equals(other.getCommentId()))
            && (this.getCommentDesc() == null ? other.getCommentDesc() == null : this.getCommentDesc().equals(other.getCommentDesc()))
            && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
            && (this.getProductId() == null ? other.getProductId() == null : this.getProductId().equals(other.getProductId()))
            && (this.getCommentTime() == null ? other.getCommentTime() == null : this.getCommentTime().equals(other.getCommentTime()))
            && (this.getCommentPoint() == null ? other.getCommentPoint() == null : this.getCommentPoint().equals(other.getCommentPoint()))
            && (this.getCommentAnswer() == null ? other.getCommentAnswer() == null : this.getCommentAnswer().equals(other.getCommentAnswer()))
            && (this.getIsanswer() == null ? other.getIsanswer() == null : this.getIsanswer().equals(other.getIsanswer()))
            && (this.getBusinessId() == null ? other.getBusinessId() == null : this.getBusinessId().equals(other.getBusinessId()))
            && (this.getMyorderDetailId() == null ? other.getMyorderDetailId() == null : this.getMyorderDetailId().equals(other.getMyorderDetailId()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getCommentId() == null) ? 0 : getCommentId().hashCode());
        result = prime * result + ((getCommentDesc() == null) ? 0 : getCommentDesc().hashCode());
        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
        result = prime * result + ((getProductId() == null) ? 0 : getProductId().hashCode());
        result = prime * result + ((getCommentTime() == null) ? 0 : getCommentTime().hashCode());
        result = prime * result + ((getCommentPoint() == null) ? 0 : getCommentPoint().hashCode());
        result = prime * result + ((getCommentAnswer() == null) ? 0 : getCommentAnswer().hashCode());
        result = prime * result + ((getIsanswer() == null) ? 0 : getIsanswer().hashCode());
        result = prime * result + ((getBusinessId() == null) ? 0 : getBusinessId().hashCode());
        result = prime * result + ((getMyorderDetailId() == null) ? 0 : getMyorderDetailId().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", commentId=").append(commentId);
        sb.append(", commentDesc=").append(commentDesc);
        sb.append(", userId=").append(userId);
        sb.append(", productId=").append(productId);
        sb.append(", commentTime=").append(commentTime);
        sb.append(", commentPoint=").append(commentPoint);
        sb.append(", commentAnswer=").append(commentAnswer);
        sb.append(", isanswer=").append(isanswer);
        sb.append(", businessId=").append(businessId);
        sb.append(", myorderDetailId=").append(myorderDetailId);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}